﻿namespace Library.OrmEnterpriseEntity.TableInfo {
	///<summary>
	///</summary>
	public class Table : DbTable {
		protected Table(DbTableView metadata)
			: base(metadata) {
		}
		public sealed override ColumnCollection Columns {
			get {
				return base.Columns;
			}
		}

		protected SingleColumn AddSingle(SingleColumnView metadata) {
			if (IsInitialize) return new SingleColumn(metadata, this);
			BeginInit();
			var result = new SingleColumn(metadata, this);
			EndInit();
			return result;
		}
		protected Int32Column AddInt32(Int32ColumnView metadata) {
			if (IsInitialize) return new Int32Column(metadata, this);

			BeginInit();
			var result = new Int32Column(metadata, this);
			EndInit();
			return result;
		}

		protected Int64Column AddInt64(Int64ColumnView metadata) {
			if (IsInitialize) return new Int64Column(metadata, this);
			BeginInit();
			var result = new Int64Column(metadata, this);
			EndInit();
			return result;
		}


		protected DateColumn AddDate(DateColumnView metadata) {
			if (IsInitialize) return new DateColumn(metadata, this);
			BeginInit();
			var result = new DateColumn(metadata, this);
			EndInit();
			return result;
		}

		protected DateTimeColumn AddDateTime(DateTimeColumnView metadata) {
			if (IsInitialize) return new DateTimeColumn(metadata, this);
			BeginInit();
			var result = new DateTimeColumn(metadata, this);
			EndInit();
			return result;
		}


		protected BooleanColumn AddBoolean(BooleanColumnView metadata) {
			if (IsInitialize) return new BooleanColumn(metadata, this);
			BeginInit();
			var result = new BooleanColumn(metadata, this);
			EndInit();
			return result;
		}

		protected AnsiColumn AddAnsi(AnsiColumnView metadata) {
			if (IsInitialize) return new AnsiColumn(metadata, this);
			BeginInit();
			var result = new AnsiColumn(metadata, this);
			EndInit();
			return result;
		}

		protected FixAnsiColumn AddFixAnsi(FixAnsiColumnView metadata) {
			if (IsInitialize) return new FixAnsiColumn(metadata, this);
			BeginInit();
			var result = new FixAnsiColumn(metadata, this);
			EndInit();
			return result;
		}

		protected FixUnicodeColumn AddFixUnicode(FixUnicodeColumnView metadata) {
			if (IsInitialize) return new FixUnicodeColumn(metadata, this);
			BeginInit();
			var result = new FixUnicodeColumn(metadata, this);
			EndInit();
			return result;
		}

		protected UnicodeColumn AddUnicode(UnicodeColumnView metadata) {
			if (IsInitialize) return new UnicodeColumn(metadata, this);
			BeginInit();
			var result = new UnicodeColumn(metadata, this);
			EndInit();
			return result;
		}

		protected ByteColumn AddByte(ByteColumnView metadata) {
			if (IsInitialize) return new ByteColumn(metadata, this);
			BeginInit();
			var result = new ByteColumn(metadata, this);
			EndInit();
			return result;
		}

		protected ByteArrayColumn AddByteArray(ByteArrayColumnView metadata) {
			if (IsInitialize) return new ByteArrayColumn(metadata, this);
			BeginInit();
			var result = new ByteArrayColumn(metadata, this);
			EndInit();
			return result;
		}


		protected Int16Column AddInt16(Int16ColumnView metadata) {
			if (IsInitialize) return new Int16Column(metadata, this);
			BeginInit();
			var result = new Int16Column(metadata, this);
			EndInit();
			return result;
		}


		protected DoubleColumn AddDouble(DoubleColumnView metadata) {
			if (IsInitialize) return new DoubleColumn(metadata, this);
			BeginInit();
			var result = new DoubleColumn(metadata, this);
			EndInit();
			return result;
		}
		protected DecimalColumn AddDecimal(DecimalColumnView metadata) {
			if (IsInitialize) return new DecimalColumn(metadata, this);
			BeginInit();
			var result = new DecimalColumn(metadata, this);
			EndInit();
			return result;
		}
	}
}
